<?php
/**
 *	@name		V认证
 *	@author		Jeffery
 *	@qq			1017756891
 *	@email		1017756891@qq.com
 *	@website	http://www.iweitao.net
**/


require_once "core.php";

checklogin_authenticate();
checkstatus_authenticate(); //检查插件状态
checkgroup_authenticate();  //检查允许使用的用户组 
//进行判断操作，是否认证成功
$info = GET_USER_V_INFO($_G['uid']);

//确认信息提交
if(submitcheck("submit")) {
	//使用安全方式获取当前数据，判断是否提交
	$name = $global->_post("username");
	$phone = $global->_post("phone");
	$idcode = $global->_post("idcode");
	$qqcode = $global->_post("qqcode");
	$email = $global->_post("mail");
	if(empty($idcode) && empty($email) && empty($qqcode) && empty($phone)) {
		showmessage($lang[14]); //判断信息是否合法
	}
	if(GET_USER_V_INFO($_G['uid'])) {
		showmessage($lang[16]);
	}
	if($_FILES["top"]["name"] == null && $_FILES["back"]["name"] == null) {
		showmessage($lang[13]); //图片为空，禁止提交
	}
	$path = "./source/plugin/authenticate/data/"; //声明上传目录
	$top  = $_G['uid']."@index.gif";  //获取正面文件名
	$back = $_G['uid']."@back.gif"; //获取背面文件名
	$index  = $path.$top;
	$bottom = $path.$back;
	
	//移动文件
	move_uploaded_file($_FILES["top"]["tmp_name"],$index);
	move_uploaded_file($_FILES["back"]["tmp_name"],$bottom);
	
	
	DB::query("INSERT INTO `$weitao_authenticate` VALUES($uid,'$username','$name','$phone','$idcode','$qqcode','$email','$top','$back','0')");
	showmessage($lang[15],'home.php?mod=spacecp&ac=plugin&op=profile&id=authenticate:V');
	
}

?>